package com.hsylient.javase.chapter13;

import cn.hutool.core.util.ClassLoaderUtil;
import com.hsylient.javase.draftpaper.ClassLoadTest;
import com.hsylient.javase.draftpaper.ProxyTest;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

@Slf4j
public class ClassLoaderTest {

    @Test
    @SneakyThrows
    public void testFilePath() {
        String name = "username";
        Class<?> aClass2 = ClassLoadTest.class.getClassLoader().loadClass("java.lang.String");
        System.out.println(aClass2);

        Class<?> proxyTestClass = ClassLoaderUtil.loadClass("com/hsylient/javase/draftpaper/ProxyTest");
        ProxyTest proxyTest = (ProxyTest) proxyTestClass.getDeclaredConstructor().newInstance();
        proxyTest.assessGoogle();
    }
}
